libre: Use default Build/Compile routing
authorSebastian Kemper <[email protected]>
Sun, 26 Nov 2017 20:58:15 +0000 (21:58 +0100)
committerSebastian Kemper <[email protected]>
Sun, 26 Nov 2017 20:58:22 +0000 (21:58 +0100)
Change from custom make call to using the default Build/Compile routine.
This applies the standard memory corruption mitigation methods, e.g.
FORTIFY_SOURCE and RELRO to the package, if they are enabled (default).

Signed-off-by: Sebastian Kemper <[email protected]>
libs/re/Makefile

index 52774c680ab73d1d29f352f18a602e130a8b8c4c..7fcafe83f66dfdab57570914382e6744fc63007a 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=re
 PKG_VERSION:=0.5.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.creytiv.com/pub
@@ -20,6 +20,8 @@ PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=docs/COPYING
 PKG_MAINTAINER:=Jiri Slachta <[email protected]>
 
+PKG_INSTALL:=1
+
 include $(INCLUDE_DIR)/package.mk
 
 define Package/libre
@@ -31,26 +33,26 @@ define Package/libre
   URL:=http://www.creytiv.com/
 endef
 
-TARGET_CFLAGS += $(FPIC)
+# re.mk is used for this and all related packages (rem, restund and baresip).
+# It relies on SYSROOT and SYSROOT_ALT being set. SYSROOT is used for finding
+# toolchain headers (like pthread.h). SYSROOT_ALT is used for finding headers
+# from other packages, like openssl etc.
+#
+# CFLAGS are picked up from the environment, as well as CPPFLAGS (and LD etc.).
+# But LDFLAGS aren't picked up, so they need to be handed over via
+# EXTRA_LFLAGS.
 
 ifneq ($(CONFIG_USE_GLIBC)$(CONFIG_USE_MUSL),)
 TARGET_CFLAGS += -D_GNU_SOURCE
 endif
 
-define Build/Compile
-       $(MAKE) -C $(PKG_BUILD_DIR) \
-               HAVE_LIBRESOLV= \
-               CC="$(TARGET_CC)" \
-               EXTRA_CFLAGS="$(TARGET_CFLAGS) -DOPENWRT" \
-               EXTRA_LFLAGS="-lm" \
-               DESTDIR="$(PKG_INSTALL_DIR)" \
-               SYSROOT="$$$$($(FIND) $(TOOLCHAIN_DIR) -path '*/include/pthread.h' | sed -ne '1s#/include/pthread.h##p')" \
-               SYSROOT_ALT="$(STAGING_DIR)/usr" \
-               RELEASE=1 \
-               CROSS_COMPILE="$(TARGET_CROSS)" \
-               OS=linux \
-               all install
-endef
+MAKE_FLAGS+= \
+       HAVE_LIBRESOLV= \
+       EXTRA_LFLAGS="$(TARGET_LDFLAGS)" \
+       SYSROOT="$(shell $(FIND) $(TOOLCHAIN_DIR) -path '*/include/pthread.h' | sed -ne '1s|/include/pthread.h||p')" \
+       SYSROOT_ALT="$(STAGING_DIR)/usr" \
+       RELEASE=1 \
+       OS=linux
 
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/share/re